import 'package:flutter/material.dart';
import 'package:flutterappyidongjingfen/Extension/touch_callback.dart';


//分割线
Widget dividerLine(){
  return Container(
      margin: EdgeInsets.fromLTRB(15, 10, 15, 0),
      child: Divider(height: 1.0,color: Color.fromRGBO(11, 13, 28, 1))
  );
}

//提问关注
Widget bottomQuestion(){
  var isFavorite = false;
  return Container(
//    height: 40,
    margin: EdgeInsets.only(left: 0,right: 0),
    child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: <Widget>[
        TouchCallBack(
            child:  Row(
              children: <Widget>[
                Icon(Icons.chat,color: Colors.white70,size: 16,),
                Text("提问",style: TextStyle(fontSize: 13.0,color: Colors.white70))
              ],
            ),
            onPressed: (){print("提问");}),
        TouchCallBack(
            child:  Row(
              children: <Widget>[
                Icon(Icons.favorite_border,color: Colors.white70,size: 16,),
                Text("关注",style: TextStyle(fontSize: 13.0,color: Colors.white70))
              ],
            ),
            onPressed: (){print("关注");})
      ],
    ),
  );
}

///上图下文字
Column buildButtonColumn(Color color, Image image, String label) {
  return Column(
    mainAxisSize: MainAxisSize.min,
//    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
    children: [
      image,
      Container(
        margin: const EdgeInsets.only(top: 10),
        child: Text(
          label,
          style: TextStyle(
            fontSize: 13,
            fontWeight: FontWeight.w400,
            color: Colors.white,
          ),
        ),
      ),
    ],
  );
}

///顶部轮播图
Widget titleCard(String title,String numberString,String subTitle){
  return Container(
    margin: EdgeInsets.only(left: 5,right: 5,bottom: 5),
    height: 182,
    child: Stack(
      children: <Widget>[
        Opacity(
          opacity: 0.15,
          child: Container(
            margin: EdgeInsets.only(top: 8, left: 0,right: 0,bottom: 8),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.all(Radius.circular(10.0)),
              gradient:  LinearGradient(
                  colors: [
                    Color(0xFF00C6FB).withOpacity(1),
                    Color(0xFF006CED).withOpacity(1)]
              ),
            ),
          ),
        ),
        Opacity(
          opacity: 0.2,
          child: Container(
            margin: EdgeInsets.only(top: 5, left: 7,right: 7,bottom: 5),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.all(Radius.circular(10.0)),
              gradient:  LinearGradient(
                  colors: [
                    Color(0xFF00C6FB).withOpacity(1),
                    Color(0xFF006CED).withOpacity(1)]
              ),
            ),
          ),
        ),
      Container(
      height: 182,
      margin: EdgeInsets.only(left: 15,right: 15),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.all(Radius.circular(10.0)),
        image: DecorationImage(
         image: AssetImage("images/banner.png"),
          fit: BoxFit.cover,
        ),
      ),
    ),
      Container(
        margin: EdgeInsets.only(left: 35,right: 0,top: 20,bottom: 20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            Text(title,style: TextStyle(fontSize: 15.0,color: Colors.white)),
            Text(numberString,style: TextStyle(fontSize: 60.0,color: Colors.white)),
            Text(subTitle,style: TextStyle(fontSize: 12.0,color: Colors.white70)),
          ],
        ),
      ),
        Container(
          margin: EdgeInsets.only(top: 160),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Stack(
                children: <Widget>[
                  SizedBox(
                      width: 10,
                      height: 10,
                      child: Container(
                        decoration: ShapeDecoration(
                          gradient: LinearGradient(
                            begin: Alignment.topCenter,
                            end: Alignment.bottomCenter,
                            colors: [Colors.lightBlueAccent,Colors.lightBlueAccent],
                          ),
                          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
                        ),
                        child: Center(
                          child: Container(
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(3),
                              color: Colors.white
                            ),
                            width: 6,
                            height: 6,
//                            color: Colors.red,
                          ),
                        ),
                      )
                  ),
                ],
              ),
              Padding(padding: EdgeInsets.only(left: 5)),
              SizedBox(
                width: 5,
                height: 5,
                child: Container(
                  decoration: ShapeDecoration(
                    gradient: LinearGradient(
                      begin: Alignment.topCenter,
                      end: Alignment.bottomCenter,
                      colors: [Colors.lightBlueAccent,Colors.lightBlueAccent],
                    ),
                    shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2.5)),
                  ),

                ),
              ),
              Padding(padding: EdgeInsets.only(left: 5)),
              SizedBox(
                  width: 5,
                  height: 5,
                  child: Container(
                    decoration: ShapeDecoration(
                      gradient: LinearGradient(
                        begin: Alignment.topCenter,
                        end: Alignment.bottomCenter,
                        colors: [Colors.lightBlueAccent,Colors.lightBlueAccent],
                      ),
                      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2.5)),
                    ),

                  )
              ),
            ],
          ),
        ),
      ],
    ),
  );
}


Widget bottomBlockWidget(String title1,Color color1,String title2,Color color2){
  return Container(
    child: Center(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          SizedBox(
            width: 12.5,
            height: 7.5,
            child: Container(
              decoration: ShapeDecoration(

                gradient: LinearGradient(
                  begin: Alignment.topCenter,
                  end: Alignment.bottomCenter,
                  colors: [color1,color1],
//                  colors: [Color(0xFFF8A03D),Color(0xFFF8A03D)],
                ),
                shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(1)),
              ),
            ),
          ),
          Padding(padding: EdgeInsets.only(left: 3)),
          Text(title1,style: TextStyle(fontSize: 11.0,color: Colors.white70),),
          Padding(padding: EdgeInsets.only(left: 10)),
          SizedBox(
            width: 12.5,
            height: 7.5,
            child: Container(
              decoration: ShapeDecoration(
                gradient: LinearGradient(
                  begin: Alignment.topCenter,
                  end: Alignment.bottomCenter,
                  colors: [color2,color2],
                ),
                shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(1)),
              ),
            ),
          ),
          Padding(padding: EdgeInsets.only(left: 3)),
          Text(title2,style: TextStyle(fontSize: 11.0,color: Colors.white70),)
          ///1AEFBA
        ],

      ),
    ),
  );
}


///导航栏
Widget NavgationBar(String title,BuildContext context) {
  return Container(
    margin: EdgeInsets.only(left: 0, right: 15, top: 40),
    height: 30,
    child: Row(
      children: <Widget>[
        // 返回按钮
        TouchCallBack(
          isfeed: false,
          onPressed: () {
            Navigator.pop(context);
          },
          child: Container(
//              height: 40.0,
            margin: const EdgeInsets.only(left: 12.0, right: 10.0),
            child: Icon(
              Icons.chevron_left,
              color: Colors.white,
              size: 30,
            ),
          ),
        ),
        //输入框
        Expanded(
            child: Text(
              title,
              textAlign: TextAlign.center,
              style: TextStyle(fontSize: 18, color: Colors.white),
            )
        ),
        Padding(padding: EdgeInsets.only(right: 42)),
      ],
    ),
  );
}